package com.hivetech.models;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

@Document
public class Report {
    @Id
    public String Id;
    public String name;
    public float score = 0;
    public String works;
    public String plan;
    public float workTime;
    public float playTime;
    public float planWork;
    public float planPlay;
    public String date = null;

    public void setDate() {
        Date curDate = new Date();
        if (curDate.getHours() < 2){
            Calendar calendar = Calendar.getInstance();
            calendar.add(Calendar.DATE,-1);
            curDate = calendar.getTime();
        }
        this.date =  (new SimpleDateFormat("yyyy-MM-dd")).format(curDate);
    }
}
